﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        phContulMeu.Controls.Clear();
        if (Page.User.Identity.IsAuthenticated)
        {
            var liDevider = new HtmlGenericControl("li");
            liDevider.Attributes["class"] = "divider";
            phContulMeu.Controls.Add(liDevider);


            var li = new HtmlGenericControl("li");
            li.InnerHtml = "<a href=\"" + Page.GetRouteUrl("Profile", new {}) + "\" class=\"myAccount\">Contul Meu</a> ";
            phContulMeu.Controls.Add(li);
        }
        phAdminPanel.Controls.Clear();
        if (Page.User.IsInRole("Admin"))
        {
            var liDevider = new HtmlGenericControl("li");
            liDevider.Attributes["class"] = "divider";
            phAdminPanel.Controls.Add(liDevider);

            var li = new HtmlGenericControl("li");
            li.InnerHtml = "<a href=\"" + Page.GetRouteUrl("Default", new {}) + "\" class=\"nav6\">Panou Admin</a> ";
            phAdminPanel.Controls.Add(li);
        }

        BannerRotator1.AdvertisementFile = Page.ResolveUrl("~/Adds/banners.xml");
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Response.RedirectToRoutePermanent("Cautare", new { search = search_txt.Text });
    }
}
